From: Shouvik Kar Date: Fri, 17 Jul 2026 18:17:04 +0000 (+0000) Subject: [PATCH] WidgetsAskUserActionHandler: show the SSL error dialog on the GUI thread X-Git-Tag: archive/raspbian/6.30.0-1+rpi1^2^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=63563ab8cd13bf65383a7ad45ac398e790aae9fa;p=kf6-kio.git [PATCH] WidgetsAskUserActionHandler: show the SSL error dialog on the GUI thread askIgnoreSslErrors() can be called from a non-GUI thread (e.g. the weather ion runs its KIO jobs on a worker thread), where it constructed the KMessageDialog off the GUI thread and crashed while painting it. Marshal the dialog onto the GUI thread with QMetaObject::invokeMethod(qGuiApp, ...), like every other handler in this class already does. BUG: 519614 Gbp-Pq: Name upstream_dd40b4c0_WidgetsAskUserActionHandler-show-the-SSL-error-dialog-on-the-GUI-thread.patch --- diff --git a/src/widgets/widgetsaskuseractionhandler.cpp b/src/widgets/widgetsaskuseractionhandler.cpp index db8d895..85aedca 100644 --- a/src/widgets/widgetsaskuseractionhandler.cpp +++ b/src/widgets/widgetsaskuseractionhandler.cpp @@ -502,32 +502,34 @@ void KIO::WidgetsAskUserActionHandler::setWindow(QWidget *window) void KIO::WidgetsAskUserActionHandler::askIgnoreSslErrors(const QVariantMap &sslErrorData, QWidget *parent) { - QWidget *parentWidget = d->getParentWidget(parent); + QMetaObject::invokeMethod(qGuiApp, [=, this] { + QWidget *parentWidget = d->getParentWidget(parent); - QString message = i18n("The server failed the authenticity check (%1).\n\n", sslErrorData[QLatin1String("hostname")].toString()); + QString message = i18n("The server failed the authenticity check (%1).\n\n", sslErrorData[QLatin1String("hostname")].toString()); - message += sslErrorData[QLatin1String("sslError")].toString(); + message += sslErrorData[QLatin1String("sslError")].toString(); - auto *dialog = new KMessageDialog(KMessageDialog::WarningTwoActionsCancel, message, parentWidget); + auto *dialog = new KMessageDialog(KMessageDialog::WarningTwoActionsCancel, message, parentWidget); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->setCaption(i18n("Server Authentication")); - dialog->setIcon(QIcon{}); - dialog->setButtons(KGuiItem{i18n("&Details"), QStringLiteral("documentinfo")}, KStandardGuiItem::cont(), KStandardGuiItem::cancel()); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->setCaption(i18n("Server Authentication")); + dialog->setIcon(QIcon{}); + dialog->setButtons(KGuiItem{i18n("&Details"), QStringLiteral("documentinfo")}, KStandardGuiItem::cont(), KStandardGuiItem::cancel()); + + connect(dialog, &KMessageDialog::finished, this, [this, parentWidget, sslErrorData](int result) { + if (result == KMessageDialog::PrimaryAction) { + showSslDetails(sslErrorData, parentWidget); + } else if (result == KMessageDialog::SecondaryAction) { + // continue(); + Q_EMIT askIgnoreSslErrorsResult(1); + } else if (result == KMessageDialog::Cancel) { + // cancel(); + Q_EMIT askIgnoreSslErrorsResult(0); + } + }); - connect(dialog, &KMessageDialog::finished, this, [this, parentWidget, sslErrorData](int result) { - if (result == KMessageDialog::PrimaryAction) { - showSslDetails(sslErrorData, parentWidget); - } else if (result == KMessageDialog::SecondaryAction) { - // continue(); - Q_EMIT askIgnoreSslErrorsResult(1); - } else if (result == KMessageDialog::Cancel) { - // cancel(); - Q_EMIT askIgnoreSslErrorsResult(0); - } + dialog->show(); }); - - dialog->show(); } void KIO::WidgetsAskUserActionHandler::showSslDetails(const QVariantMap &sslErrorData, QWidget *parentWidget)